package com.xbongbong.formula.qlexpress.operator.text;

import com.ql.util.express.Operator;
import com.xbongbong.paas.toolbox.util.MD5Util;

/**
 * @author: chy
 * @date: 2018/7/5 15:22
 * @desrcption: 将文本字符串进行MD5加密
 */
public class OperatorMd5 extends Operator {

    public OperatorMd5(String name){
        this.name = name;
    }

    public OperatorMd5(String aliasName, String name, String errorInfo){
        this.aliasName = aliasName;
        this.name = name;
        this.errorInfo = errorInfo;
    }

    /**
     *
     * @param list
     * @return
     * example： String str = "MD5(\"2018\")";
     * @throws Exception
     */
    @Override
    public Object executeInner(Object[] list) throws Exception {
        return MD5Util.md5(list[0].toString());
    }
}
